var authkey = request("authkey");

function server_open(key)    {   //  开通服务
    $.get("modify",{"authkey":authkey,"key":key,"value":1}).success(function(){
        if (key == "app_open"){
            app_open = 1;
            swal({
                title: _alert_Successful_app
            },function (){
                $(".ones").hide();
                $(".one").hide();
                $(".onees").show();
            })
        }else if (key == "email_open"){
            email_open = 1;
            swal({
                title: _alert_Successful_email
            },function (){
                getEmail();
            })
        }else if (key == "tel_open"){
            tel_open = 1;
            swal({
                title: _alert_Successful_tel
            },function (){
                gettel();
            })
        }else if (key == "weChat_open"){
            weChat_open = 1;
            swal({
                title: _alert_Successful_weChet
            },function (){
                $(".fours").hide();
                $(".four").hide();
                $(".foures").show();
            })
        }
    })
}

function server_close(key) {      //关闭服务
    var txt ="";
    if (key == "app_open"){
        txt = "确认关闭客户端服务通知吗?"
    }else if (key == "email_open") {
        txt = "确认关闭邮件通知吗?"
    }else if (key == "tel_open") {
        txt = "确认关闭电话通知吗?"
    }else if (key == "weChat_open") {
        txt = "确认关闭微信端通知吗?"
    }
    swal({
            title: txt,
            showCancelButton: true
        },function (){
            $.get("modify",{"authkey":authkey,"key":key,"value":0}).success(function(){
                if (key == "app_open"){
                    app_open = 0;
                    $(".ones").hide();
                    $(".one").show();
                    $(".onees").hide();
                }else if (key == "email_open"){
                    email_open = 0;
                    $(".twos").hide();
                    $(".two").show();
                    $(".twoes").hide()
                }else if (key == "tel_open"){
                    tel_open = 0;
                    $(".threes").hide();
                    $(".three").show();
                    $(".threeis").hide();
                }else if (key == "weChat_open"){
                    weChat_open = 0;
                    $(".fours").hide();
                    $(".four").show();
                    $(".foures").hide();
                }
            });
        }
    )
}


function request(paras) {
    var url = location.href;
    var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");
    var paraObj = {}
    for (i=0;j=paraString[i];i++){
        paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);
    }
    var returnValue = paraObj[paras.toLowerCase()];
    if(typeof(returnValue)=="undefined"){
        return "";
    }else{
        return returnValue;
    }
}
